
function addPrefixZero(m) {
  let _m = Math.abs(parseInt(m));
  return _m < 10 ? `0${_m}` : `${_m}`;
}
export default {
  date: (() => {
    var date = new Date();
    var dateObject = {
      month: date.getMonth() + 1,
      day: date.getDay(),
      year: date.getFullYear(),
      hour: date.getHours(),
      minute: date.getMinutes(),
      second: date.getSeconds(),
      timestamp: Date.parse(date) / 1000,
    };
    dateObject._month = addPrefixZero(dateObject.month);
    dateObject._day = addPrefixZero(dateObject.day);
    dateObject._hour = addPrefixZero(dateObject.hour);
    dateObject._minute = addPrefixZero(dateObject.minute);
    dateObject._second = addPrefixZero(dateObject.second);
    dateObject.format_time = `${dateObject.year}-${dateObject._month}-${dateObject._day} ${dateObject._hour}:${dateObject._minute}:${dateObject._second}`;
    dateObject.format_month = `${dateObject.year}-${dateObject._month}`;
    dateObject.format_dot_month = `${dateObject.year}.${dateObject._month}`;
    dateObject.format_day = `${dateObject.year}-${dateObject._month}-${dateObject._day}`;
    return dateObject;
  })(),
};